-- 房间ID
local room_id = KEYS[1]
-- 活跃人数不存在
if redis.call('exists', 'wooha_cache_hub:room:active_user:' .. room_id) == 0 then
    return {0}
end
-- 活跃用户KEYS
local keys = redis.call('hkeys', 'wooha_cache_hub:room:active_user:' .. room_id)
-- 当前时间戳
local now_ts = tonumber(redis.call('time')[1])
-- 过期的活跃用户KEYS
local expire_keys = {}
-- 遍历活跃用户
for index, key in ipairs(keys) do
    local value = tonumber(redis.call('hget', 'wooha_cache_hub:room:active_user:' .. room_id, key))
    if value + 15 < now_ts then
        expire_keys[#expire_keys + 1] = key
    end
end
-- 删除过期活跃用户
redis.call('hdel', 'wooha_cache_hub:room:active_user:' .. room_id, unpack(expire_keys))
return {0}
